﻿using System;
using System.Web.UI;
using SouthernLand.Common;

namespace SouthernLand.WebMaster.Controls.Contacts
{
    public partial class ContactSetting : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Common.BOL.Contact.ContactSetting contact = Common.BOL.Contact.ContactSetting.GetContactSettingByID(1);
                txtAdminEmail.Text = contact.AdminEmail;
                txtCompany.Text = contact.CompanyName;
                txtEmail.Text = contact.Email;
                txtFax.Text = contact.Fax;
                txtPhone.Text = contact.Phone;
                txtHotline.Text = contact.Hotline;
                txtAddress.Text = contact.Address;
            }
        }

        protected void btSave_Click(object sender, EventArgs e)
        {
            var obj = new Common.BOL.Contact.ContactSetting();
            obj.ContactSettingID = 1;
            obj.AdminEmail = txtAdminEmail.Text;
            obj.CompanyName = txtCompany.Text;
            obj.Email = txtEmail.Text;
            obj.Fax = txtFax.Text;
            obj.Phone = txtPhone.Text;
            obj.Hotline = txtHotline.Text;
            obj.Address = txtAddress.Text;
            Common.BOL.Contact.ContactSetting.Update(obj);
            lblMsg.Text = ResourceManager.GetString("ModifiedSuccessfully");
            PanelMsg.Visible = true;
        }
    }
}